<?php

/**
 * Class: Community_Form_time
 * @author ovo
 * This form enables the user submit a the time the specific course was taken before rating
 * it 
 */
class Community_Form_compare extends Zend_Dojo_Form {
	
	public function __construct($options = null){	
 		
	parent::__construct($options);
	Zend_Dojo::enableForm($this);
	 
	$this->setName('When did you take this course');
	
	
	//First Course
	$fi = Zend_Controller_Front::getInstance();
	$val = $fi->getRequest()->getParam('school');
	$course = new Zend_Dojo_Form_Element_FilteringSelect('course');
	$course->setLabel("Choose the first course : ");
	$listcourses = new Admin_Model_DbTable_Courses();
	$list = $listcourses->fetchAll('school_id ='. $val, 'course_no');
	
	foreach($list as $l){
	  $course->addMultiOption($l->id, $l->course_no . "--" .$l->name);
	}
		$course->setAttrib("style","width:21em");
	
	//semester
	$courseSemester = new Zend_Dojo_Form_Element_FilteringSelect('semester');
	$courseSemester->setLabel('Enter the course semester:');
	$courseSemester->setRequired(true);
	
	$options = array (
	  'fall' => 'fall',
	  'summer' => 'summer',
	  'spring' => 'spring'
	);
	
	$courseSemester->addMultiOptions($options);
	
	//year
	$courseYear = new Zend_Dojo_Form_Element_FilteringSelect('year');
	$courseYear->setLabel('Enter the course year');
	$courseYear->setRequired(true);
	$Newoptions2 = array (
	  '2000' => '2000',
	  '2001' => '2001',
	  '2002' => '2002',
	  '2003' => '2003',
	  '2004' => '2004',
	  '2005' => '2005',
	  '2006' => '2006',
	  '2007' => '2007',
	  '2008' => '2008',
	  '2009' => '2009',
	  '2010' => '2010'
	  
	);
	$courseYear->addMultiOptions($Newoptions2);

	
	/**Second course **.
	 */
	$course2 = new Zend_Dojo_Form_Element_FilteringSelect('course2');
	$course2->setLabel("Choose the second course:");
	$course2->setAttrib("style","width:21em");
	foreach($list as $l)
	  $course2->addMultiOption($l->id, $l->course_no . "--" .$l->name);
	
	
	//semester
	$courseSemester2 = new Zend_Dojo_Form_Element_FilteringSelect('semester2');
	$courseSemester2->setLabel('Enter the course semester:');
	$courseSemester2->setRequired(true);
	
	$courseSemester2->addMultiOptions($options);
	
	//year
	$courseYear2 = new Zend_Dojo_Form_Element_FilteringSelect('year2');
	$courseYear2->setLabel('Enter the course year');
	$courseYear2->setRequired(true);

	$courseYear2->addMultiOptions($Newoptions2);
	$this->addElements(array($course,$courseSemester, $courseYear, $course2, $courseSemester2, $courseYear2));	
	
	

	$submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
	$submit->setLabel("Compare!");
	$this->setMethod('GET');
	$this->addElement($submit);
	 
	}
}